#include "ImageWidget.h"
#include "Render/Widget/RenderWidgets.h"


void RImageWidget::PaintSelf(uint16_t& InZOrder,const SRect& InClipArea)
{
    auto _Image= Image.Get();
    if(!_Image)
    {
        return;
    }

    auto RenderImageWidget= std::make_shared< SRenderImageWidget>();
    RenderImageWidget->Rect= SRect(PresentAbsPosition,PresentSize);
    RenderImageWidget->ClipRect=InClipArea;
    RenderImageWidget->ZOrder=InZOrder;
    InZOrder++;

    RenderImageWidget->Image=_Image->GetRenderTexture();
    RenderImageWidget->ScaleMethod= ScaleMethod.Get();
    RenderImageWidget->CustomLeftTopUV= CustomLeftTopUV.Get();
    RenderImageWidget->CustomRightBottomUV= CustomRightBottomUV.Get();
    RenderImageWidget->TintColor=TintColor.Get();

    PaintRenderWidget(RenderImageWidget);
}

